<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>生产效率分析</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 生产分析 <span class="c-gray en">&gt;</span> 生产效率分析 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
	<span class="select-box" style="width:220px;margin-top:12px;">
	  <select class="select size-S" size="1" name="changeSele" id="changeSele">
	    <option value="总产仔数" selected>总产仔数</option>
	    <option value="各月配种次数">各月配种次数</option>
	  </select>
	</span>
</div>
</div>
<div id="main" style="height:400px;width:90%;margin:0 auto;"></div>
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
<script src="../lib/echars/dist/echarts-all.js"></script>
<script type="text/javascript">
$("#changeSele").change(function(){//监听客户名称选择框改变
	var value = $(this).val();
	getScxl(value);
});

getScxl("总产仔数");

function getScxl(val){
	$.post("/product_analysis/getProductivityByDate.do",{"type":val},function(data) {
        var obj = eval('(' + data + ')');
        var option = {
            title : {
                text: '生产效率分析',
                subtext: val,
            },
            tooltip : {
                trigger: 'axis',
                axisPointer : {
                    type: 'shadow'
                }
            },
            legend: {
                data:['猪场']
            },
            toolbox: {
                show : true,
                orient : 'vertical',
                y : 'center',
                feature : {
                    mark : {show: true},
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            calculable : true,
            xAxis : [
                {
                    type : 'category',
                    //data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月']
                    data:(function(){
                        var res = [];
                        for (var i = 0; i < obj.length; i++) {
                            var info = obj[i];
                            res.push(info.months);
                        }
                        return res;
                    })()
                }
            ],
            yAxis : [
                {
                    type : 'value',
                    splitArea : {show : true}
                }
            ],
            grid: {
                x2:40
            },
            series : [
                {
                    name:'猪场',
                    type:'line',
                    stack: '总量',
                    // data:[5, 10, 5, 3, 4, 4, 5, 10, 3, 4]
                    data:(function(){
                        var res = [];
                        for (var i = 0; i < obj.length; i++) {
                            var info = obj[i];
                            res.push(info.counts);
                        }
                        return res;
                    })()
                }]
        };
        var myChart = echarts.init(document.getElementById('main'));
        myChart.hideLoading();
        myChart.setOption(option);
	});
}    
</script>
</body>
</html>